<?php

namespace App\Winged\Middleware;

use Closure;
use Encore\Admin\Admin;
use Illuminate\Support\Facades\Auth;

class Tenant
{
	/**
	* Handle an incoming request.
	*
	* @param \Illuminate\Http\Request $request
	* @param \Closure                 $next
	*
	* @return mixed
	*/
	public function handle($request, Closure $next)
	{
		// Try to determine current tenant and init. If any problem, the tenant service will auto redirect.
		app()->tenant->init();
		return $next($request);
	}

	/**
	* Determine if the request has a URI that should pass through verification.
	*
	* @param \Illuminate\Http\Request $request
	*
	* @return bool
	*/
	protected function shouldPassThrough($request)
	{
		return false;
	}
}